package com.itheima.service;

import com.itheima.config.SpringConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author Xiao
 * @date 2021/9/13
 */
//1. 使用Spring整合Junit专用的类加载器
@RunWith(SpringJUnit4ClassRunner.class)
//2. 加载配置类
@ContextConfiguration(classes = {SpringConfig.class})
public class testForAccountService {
    @Autowired
    private AccountService accountService;

    @Test
    public void testFindAll() {
        accountService.findAll();
    }

    @Test
    public void testFindById() {
        accountService.findById(1);
    }

    @Test
    public void testTransfer() {
        accountService.transfer("Jerry","Tom",200.0);
    }
}
